﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Globalization;
/// <summary>
/// Summary description for security
/// </summary>
public class security
{
	public security()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    public string EncryptPWD(string password)
    {
        System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
        byte[] bs = System.Text.Encoding.UTF8.GetBytes(password);
        bs = x.ComputeHash(bs);
        System.Text.StringBuilder s = new System.Text.StringBuilder();
        foreach (byte b in bs)
        {
            s.Append(b.ToString("x2").ToLower());
        }
        return s.ToString();
    }
    public string convertTimeTo_Mdy(string validtime)
    {
        string sText = Convert.ToDateTime(validtime).ToShortDateString();
        DateTime dateTest;
        DateTimeFormatInfo sFormat = new DateTimeFormatInfo();
        sFormat.ShortDatePattern = "dd/MM/yyyy";
        dateTest = Convert.ToDateTime(sText, sFormat);
        string time = dateTest.ToString("MM/dd/yyyy");
        return time;
    }
    public string convertTimeTo_dMy(string validtime)
    {
        string sText = Convert.ToDateTime(validtime).ToShortDateString();
        DateTime dateTest;
        DateTimeFormatInfo sFormat = new DateTimeFormatInfo();
        sFormat.ShortDatePattern = "MM/dd/yyyy";
        dateTest = Convert.ToDateTime(sText, sFormat);
        string time = dateTest.ToString("dd/MM/yyyy");
        return time;
    }
    public string sotien(string point_number)
    {
        string result = String.Empty;
        try
        {
            switch (point_number)
            {
                case "100":
                    result = "100000";
                    break;
                case "200":
                    result = "200000";
                    break;
                case "500":
                    result = "500000";
                    break;
            }
        }
        catch
        {
        }
        return result;
    }
    public bool readCookie()
    {
        try
        {

        }
        catch (Exception)
        {
            return false;
        }
        return true;
    }
    
}